import Router from 'koa-router';
import { appPort } from './config/appSetting.js';
import Koa from 'koa'

let app = new Koa();
let router = new Router();

app.use(async(ctx,next)=>{
await next;
})

router.get('/blogs',async(ctx,next)=>{
    ctx.body='列表'
})
router.get('/blogs/:id',async(ctx,next)=>{
    ctx.body='指定博客'
})
router.post('/blogs',async(ctx,next)=>{
    ctx.body = '新增'
})
router.put('/blogs/:id',async(ctx,next)=>{
    ctx.body='修改'
})
router.delete('/blogs/:id',(ctx,next)=>{
    ctx.body='删除'
})

app.use(router.routes())
app.listen(appPort)
console.log(`服务运行于:http://localhost:${appPort}`);
